package com.ilancuo.numric;

/**
 * float和int的相互转换
 * <p>
 * Created by ilancuo on 2016/12/21.
 */
public class FloatTest {

    public static void main(String... args) {
        int a = 3;
        int b = 100;

        System.out.println(a / b); // 0
        System.out.println((float) a / b); //0.03
        System.out.println((float) a / b * 1000); //30.0
        System.out.println((int) (float) a / b * 1000); //0
        System.out.println((int) ((float) a / b * 1000)); //30

        System.out.println(100 / 3.0); //33.333333333333336
        System.out.println(100 % 3.0); //1.0
    }
}
